# -*- coding: UTF-8 -*-
import os
import sys

'''
usage:
    python rename.py newmeta/data_in_map_sorted/map_1/plane 0
    python rename.py newmeta/data_in_map_sorted/map_1/space 100000

参数 : 名字的起始值

'''

path='/home/wyj/caffe/data/eagLeNet/'+sys.argv[1]+'/'


def generateName(num):
    num=str(num)
    length=len(num)
    name=((6-length)*'0')+num
    return name

i=int(sys.argv[2])
for file in os.listdir(path):
    i+=1
    if os.path.isfile(os.path.join(path,file))==True:
        name=generateName(i)+'.jpg'
        os.rename(os.path.join(path,file),os.path.join(path,name))
        print path,':',file,'->',name
